package com.example.demo.entity;

import com.example.demo.utils.JsonAttributeConverter;

import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.List;
import java.util.Map;

/**
 * @author shenb
 * @date 2022-06-29 14:27
 */
@Entity
@Table(name = "user_inf")
public class User extends BaseEntity {


    private String name;
    private Integer age;

    @Convert(converter = JsonAttributeConverter.ListConverter.class)
    private List<String> entityFields;

    @Convert(converter = JsonAttributeConverter.MapConverter.class)
    private Map<String, String> labels;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public List<String> getEntityFields() {
        return entityFields;
    }

    public void setEntityFields(List<String> entityFields) {
        this.entityFields = entityFields;
    }

    public Map<String, String> getLabels() {
        return labels;
    }

    public void setLabels(Map<String, String> labels) {
        this.labels = labels;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
